<template>
    <el-menu ref="cpmenu" theme="light" width="auto" style="margin-bottom: 60px;" @select="goTo" class="active-left-line" :default-active="$route.name">
        <el-menu-item index="Index">
            <i class="el-icon-menu" />{{$t("工作台")}}
        </el-menu-item>
        <el-menu-item-group :title='$t("商城管理")'>
            <el-menu-item index="DisProductList">
                <i class="el-icon-menu" color="#ff0000" />{{$t("商品查询")}}
            </el-menu-item>
            <el-menu-item index="DisTradeList">
                <i class="el-icon-menu" color="#ff0000" />{{$t("商城订单")}}
            </el-menu-item>
             
        </el-menu-item-group>
        <el-menu-item-group :title='$t("仓配管理")'>
            <el-menu-item index="StorageProductList">
                <i class="el-icon-menu" color="#ff0000" />{{$t("仓储商品")}}
            </el-menu-item>
          <!--   <el-menu-item index="StorageProductChangeList">
                <i class="el-icon-menu" />{{$t("库存明细")}}
                <el-badge :value="storageChange"></el-badge>
            </el-menu-item>
            <el-menu-item index="StorageBillAdd">
                <i class="el-icon-menu" color="#ff0000" />{{$t("创建入库单")}}
            </el-menu-item>
            <el-menu-item index="StorageBillList">
                <i class="el-icon-menu" color="#ff0000" />{{$t("入库单管理")}}<el-badge :value="billCount"></el-badge>
            </el-menu-item>
            <el-menu-item index="StorageBillItemList">
                <i class="el-icon-menu" color="#ff0000" />{{$t("入库单明细")}}
            </el-menu-item> -->
        </el-menu-item-group>
    </el-menu>
</template>
<script>
export default {
    name: 'CpMenu',
    data() {
        return {
            purchareCount: 0,
            purchareShip: 0,
            purchareDelivered: 0,
            orderErrorCount: 0,
            waybillCount: 0,
            lazadaWaybillCount: 0,
            tiktokWaybillCount: 0,
            temuWaybillCount: 0,
            waybillExpressCount: 0,
            logisticsErrorCount: 0,
            toMySignCount: 0,
            billCount: 0,
            returnCount: 0,
            returnToCountToDo: 0,
            returnToCount: 0,
            errorCount: 0,
            toMyOutgoingCount: 0,
            storageChange: 0,
            virWaybillCount: 0,
            outgoReadship: 0,
            outgoTryship: 0,
            toXiapiReturn: 0

        };
    },
    methods: {
        goTo: function(active, keyPath) {


            var cpmenu = this.$refs.cpmenu;
            // this.$router.push({ name: active }, () => {}, (e) => {
            // });

            let willpush = true;
            if (this.beforePush !== undefined) {
                if (!this.beforePush(active)) {
                    willpush = false;
                }
            }
            if (willpush) {
                this.$router.push({ name: active }, () => {}, (e) => {

                });
            }
            this.$emit('on-change', active);


        }
    },
    props: {
        menuList: {
            type: Array,
            required: true
        },
        beforePush: {
            type: Function
        },
        openNames: {
            type: Array
        }
    },
    updated() {
        this.$nextTick(() => {
            var dt = this.openNames;

            if (this.$refs.cpmenu) {
                // this.$refs.cpmenu.updateOpened();
            }
        });
    }
}
</script>
<style>
</style>